from django.urls import path
from home.views import UserProfileView, TieziView, TagView, LianjieView, CreateTieziView
from rest_framework.routers import SimpleRouter

urlpatterns = [
    path('new-create-tiezi/', CreateTieziView.as_view(), name='new-create-tiezi'),
]

router = SimpleRouter()
router.register('user', UserProfileView)
router.register('tiezi', TieziView)
router.register('tag', TagView)
router.register('lianjie', LianjieView)

urlpatterns += router.urls

# 添加商品详情页的路由
urlpatterns += [
    path('lianjie/<int:productId>/', LianjieView.as_view({'get': 'retrieve'}), name='product-detail'),
]